﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace SIGEB.Modelo.moduloTipoDocumentos
{
    public class condicionString:condicion
    {

        #region "constructores"

        public condicionString(atributo valororiginal, bool sinNumeros, bool soloLetras, bool sinCaracteres, string caracters)
            : base
                (valororiginal)
        {
            this.sinCaracteres = sinCaracteres;
            this.sinNumeros = sinNumeros;
            this.soloLetras = soloLetras;
            this.caracters = caracters;
        }

        #endregion

        #region "metodos"

        public override bool valido()
        {
            if (sinNumeros && !MetodosString.sinNumeros(valororiginal.valorCampo))
            {
                return false;
            }
            if (soloLetras&&!MetodosString.soloLetras(valororiginal.valorCampo))
            {
                return false;
            }
            if (sinCaracteres && !MetodosString.sinCaracteres(valororiginal.valorCampo, caracters))
            {
                return false;
            }
            return true;
        }

        #endregion

        #region "atributos"

        bool sinNumeros;
        bool soloLetras;
        bool sinCaracteres;

        string caracters;

        #endregion
    }
}
